package me.ivps.android.testdemo;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity {
    
    String[] names = { "FirstActivity", "LaunchActivity", "SenderActivity" };
    Class<?>[] clazzes = { FirstActivity.class, LaunchActivity.class,
            SenderActivity.class };
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, names);
        setListAdapter(adapter);
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        position = position % clazzes.length;
        startActivity(new Intent(this, clazzes[position]));
    }
    
}
